package labb3.FileHandling;

import java.io.File;

/**
 * Creates a filter the JFileChooser can use to only show files with this
 * extension (*.mzd).
 *
 * @author Mikko Puustinen
 * @version 1.0, 2007-okt-17
 */
public class SerializedFileFilter extends MediaFileFilter {
    private final String extension = "mzd";

    /**
     * Whether the given file is accepted by this filter.
     *
     * @return true if the file is accepted, false otherwise.
     */
    public boolean accept(File f) {
        return f.isDirectory() || getExtension(f).equals(extension);
    }

    /**
     * The description of this filter.
     */
    public String getDescription() {
        return "MZD files";
    }

    /**
     * Returns the file extension this filter is using.
     *
     * @return the file extension (mzd).
     */
    public String getFilterExtension() {
        return extension;
    }
}
